const db= require("./conn");
class College {
    /**
     * 创建单个学院
     * @param cno
     * @param cname
     * @return {Promise<unknown>}
     */
    async Create(cno,cname){
        let res=await db.query("INSERT INTO college(cno,cname) VALUES(?,?)",
            [cno,cname]);
        return res;
    }
    /**
     * 创建多个学院
     * @param {Array<{a: number, b: string, c}>} colleges  学院数组
     * @param {String} colleges[].cname 学院名
     * @param {String} colleges[].cno 学院号
     * @return {Promise<unknown>}
     */
    async bulkCreate(colleges){
        let res=await db.query("INSERT INTO college(cname) VALUES ?",
            [colleges]);
        return res;
    }

    // async findOne(cname){
    //     let res = await db.query("SELECT uname,upsd,usalt FROM user_login WHERE uname=?",[uname]);
    //     return res;
    // }
    //
    // async find(){
    //     let res = await db.query("SELECT * FROM college ",[]);
    //     return res;
    // }
}

module.exports=new College();